/**
 * Copyright (C) 2011 ImageLoader for Android Project
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.ryan.aii;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;

/**
 * this is test class for android image loader
 */
public class AndroidImageLoader extends Activity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ImageLoader.load("http://www.daxuo.com/uploads/allimg/100712/1942211R1-1.jpg",
                findViewById(R.id.image1), callback);
        ImageLoader.load("http://sta.ganjistatic1.com/src/image/ads/20110402.jpg",
                findViewById(R.id.image2), callback);
        ImageLoader.load("http://www.daxuo.com/uploads/allimg/100712/1942211R1-1.jpg",
                findViewById(R.id.image3), callback);
        ImageLoader.load("http://sta.ganjistatic1.com/src/image/ads/20110402.jpg",
                findViewById(R.id.image4), callback);
        ImageLoader.load("http://www.daxuo.com/uploads/allimg/100712/1942211R1-1.jpg",
                findViewById(R.id.image5), callback);
        ImageLoader.load("http://sta.ganjistatic1.com/src/image/ads/20110402.jpg",
                findViewById(R.id.image6), callback);
        ImageLoader.load("http://www.daxuo.com/uploads/allimg/100712/1942211R1-1.jpg",
                findViewById(R.id.image7), callback);
        ImageLoader.load("http://sta.ganjistatic1.com/src/image/ads/20110402.jpg",
                findViewById(R.id.image8), callback);
        ImageLoader.load("http://www.daxuo.com/uploads/allimg/100712/1942211R1-1.jpg",
                findViewById(R.id.image9), callback);
        ImageLoader.load("http://image.ganjistatic1.com/gjfs01/M01/82/BB/wKhxwU3jR8LF2w6cAADnO6WpVEA429_200-122_9-1.jpg",
                findViewById(R.id.image10), callback);
        ImageLoader.load("http://www.daxuo.com/uploads/allimg/100712/1942211R1-1.jpg",
                findViewById(R.id.image11), callback);
        ImageLoader.load("http://image.ganjistatic1.com/gjfs01/M01/82/BB/wKhxwU3jR8LF2w6cAADnO6WpVEA429_200-122_9-1.jpg",
                findViewById(R.id.image12), callback);
        ImageLoader.load("http://image.ganjistatic1.com/gjfs01/M01/82/BB/wKhxwU3jR8LF2w6cAADnO6WpVEA429_200-122_9-1.jpg",
                findViewById(R.id.image13), callback);
        ImageLoader.load("http://www.daxuo.com/uploads/allimg/100712/1942211R1-1.jpg",
                findViewById(R.id.image14), callback);
    }

    private ImageLoader.Callback callback = new ImageLoader.Callback() {
        @Override
        public void onLoad(String filepath, Object data) {
            ImageView imageView = (ImageView) data;
            imageView.setImageDrawable(Drawable.createFromPath(filepath));
        }
    };
}
